<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Spec::Mocks::BaseExpectation</title>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Spec::Mocks::BaseExpectation</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/plugins/rspec/lib/spec/mocks/message_expectation_rb.html">
                vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="../../Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">



   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000213">and_raise</a>&nbsp;&nbsp;
      <a href="#M000212">and_return</a>&nbsp;&nbsp;
      <a href="#M000214">and_throw</a>&nbsp;&nbsp;
      <a href="#M000215">and_yield</a>&nbsp;&nbsp;
      <a href="#M000209">build_child</a>&nbsp;&nbsp;
      <a href="#M000218">called_max_times?</a>&nbsp;&nbsp;
      <a href="#M000210">error_generator_opts=</a>&nbsp;&nbsp;
      <a href="#M000211">expected_args</a>&nbsp;&nbsp;
      <a href="#M000217">invoke</a>&nbsp;&nbsp;
      <a href="#M000221">invoke_consecutive_return_block</a>&nbsp;&nbsp;
      <a href="#M000219">invoke_method_block</a>&nbsp;&nbsp;
      <a href="#M000222">invoke_return_block</a>&nbsp;&nbsp;
      <a href="#M000220">invoke_with_yield</a>&nbsp;&nbsp;
      <a href="#M000216">matches</a>&nbsp;&nbsp;
      <a href="#M000208">new</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">args_to_yield</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">error_generator</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">expected_from</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">expected_received_count</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">method_block</td>
          <td class="context-item-value">&nbsp;[W]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">sym</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000208" class="method-detail">
        <a name="M000208"></a>

        <div class="method-heading">
          <a href="#M000208" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(error_generator, expectation_ordering, expected_from, sym, method_block, expected_received_count=1, opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000208-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000208-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 11</span>
11:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">error_generator</span>, <span class="ruby-identifier">expectation_ordering</span>, <span class="ruby-identifier">expected_from</span>, <span class="ruby-identifier">sym</span>, <span class="ruby-identifier">method_block</span>, <span class="ruby-identifier">expected_received_count</span>=<span class="ruby-value">1</span>, <span class="ruby-identifier">opts</span>={})
12:         <span class="ruby-ivar">@error_generator</span> = <span class="ruby-identifier">error_generator</span>
13:         <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">opts</span>
14:         <span class="ruby-ivar">@expected_from</span> = <span class="ruby-identifier">expected_from</span>
15:         <span class="ruby-ivar">@sym</span> = <span class="ruby-identifier">sym</span>
16:         <span class="ruby-ivar">@method_block</span> = <span class="ruby-identifier">method_block</span>
17:         <span class="ruby-ivar">@return_block</span> = <span class="ruby-keyword kw">nil</span>
18:         <span class="ruby-ivar">@actual_received_count</span> = <span class="ruby-value">0</span>
19:         <span class="ruby-ivar">@expected_received_count</span> = <span class="ruby-identifier">expected_received_count</span>
20:         <span class="ruby-ivar">@args_expectation</span> = <span class="ruby-constant">ArgumentExpectation</span>.<span class="ruby-identifier">new</span>([<span class="ruby-constant">ArgumentConstraints</span><span class="ruby-operator">::</span><span class="ruby-constant">AnyArgsConstraint</span>.<span class="ruby-identifier">new</span>])
21:         <span class="ruby-ivar">@consecutive</span> = <span class="ruby-keyword kw">false</span>
22:         <span class="ruby-ivar">@exception_to_raise</span> = <span class="ruby-keyword kw">nil</span>
23:         <span class="ruby-ivar">@symbol_to_throw</span> = <span class="ruby-keyword kw">nil</span>
24:         <span class="ruby-ivar">@order_group</span> = <span class="ruby-identifier">expectation_ordering</span>
25:         <span class="ruby-ivar">@at_least</span> = <span class="ruby-keyword kw">nil</span>
26:         <span class="ruby-ivar">@at_most</span> = <span class="ruby-keyword kw">nil</span>
27:         <span class="ruby-ivar">@args_to_yield</span> = []
28:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000213" class="method-detail">
        <a name="M000213"></a>

        <div class="method-heading">
          <a href="#M000213" class="method-signature">
          <span class="method-name">and_raise()<br />
and_raise(Exception) #any exception class<br />
and_raise(exception) #any exception object<br />
</span>
          </a>
        </div>
      
        <div class="method-description">
          <h2>Warning</h2>
<p>
When you pass an exception class, the <a
href="MessageExpectation.html">MessageExpectation</a> will raise an
instance of it, creating it with <tt><a
href="BaseExpectation.html#M000208">new</a></tt>. If the exception class
initializer requires any parameters, you must pass in an instance and not
the class.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000213-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000213-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 78</span>
78:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">and_raise</span>(<span class="ruby-identifier">exception</span>=<span class="ruby-constant">Exception</span>)
79:         <span class="ruby-ivar">@exception_to_raise</span> = <span class="ruby-identifier">exception</span>
80:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000212" class="method-detail">
        <a name="M000212"></a>

        <div class="method-heading">
          <a href="#M000212" class="method-signature">
          <span class="method-name">and_return</span><span class="method-args">(*values, &amp;return_block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000212-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000212-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 51</span>
51:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">and_return</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">values</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">return_block</span>)
52:         <span class="ruby-constant">Kernel</span><span class="ruby-operator">::</span><span class="ruby-identifier">raise</span> <span class="ruby-constant">AmbiguousReturnError</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@method_block</span>.<span class="ruby-identifier">nil?</span>
53:         <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>
54:           <span class="ruby-keyword kw">when</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>
55:           <span class="ruby-keyword kw">when</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">then</span> <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>[<span class="ruby-value">0</span>]
56:         <span class="ruby-keyword kw">else</span>
57:           <span class="ruby-identifier">value</span> = <span class="ruby-identifier">values</span>
58:           <span class="ruby-ivar">@consecutive</span> = <span class="ruby-keyword kw">true</span>
59:           <span class="ruby-ivar">@expected_received_count</span> = <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">ignoring_args?</span> <span class="ruby-operator">&amp;&amp;</span>
60:                                                     <span class="ruby-ivar">@expected_received_count</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">size</span>
61:         <span class="ruby-keyword kw">end</span>
62:         <span class="ruby-ivar">@return_block</span> = <span class="ruby-identifier">block_given?</span> <span class="ruby-value">? </span><span class="ruby-identifier">return_block</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">lambda</span> { <span class="ruby-identifier">value</span> }
63:         <span class="ruby-comment cmt"># Ruby 1.9 - see where this is used below</span>
64:         <span class="ruby-ivar">@ignore_args</span> = <span class="ruby-operator">!</span><span class="ruby-identifier">block_given?</span>
65:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000214" class="method-detail">
        <a name="M000214"></a>

        <div class="method-heading">
          <a href="#M000214" class="method-signature">
          <span class="method-name">and_throw</span><span class="method-args">(symbol)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000214-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000214-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 82</span>
82:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">and_throw</span>(<span class="ruby-identifier">symbol</span>)
83:         <span class="ruby-ivar">@symbol_to_throw</span> = <span class="ruby-identifier">symbol</span>
84:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000215" class="method-detail">
        <a name="M000215"></a>

        <div class="method-heading">
          <a href="#M000215" class="method-signature">
          <span class="method-name">and_yield</span><span class="method-args">(*args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000215-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000215-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 86</span>
86:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">and_yield</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
87:         <span class="ruby-ivar">@args_to_yield</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">args</span>
88:         <span class="ruby-keyword kw">self</span>
89:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000209" class="method-detail">
        <a name="M000209"></a>

        <div class="method-heading">
          <a href="#M000209" class="method-signature">
          <span class="method-name">build_child</span><span class="method-args">(expected_from, method_block, expected_received_count, opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000209-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000209-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 30</span>
30:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_child</span>(<span class="ruby-identifier">expected_from</span>, <span class="ruby-identifier">method_block</span>, <span class="ruby-identifier">expected_received_count</span>, <span class="ruby-identifier">opts</span>={})
31:         <span class="ruby-identifier">child</span> = <span class="ruby-identifier">clone</span>
32:         <span class="ruby-identifier">child</span>.<span class="ruby-identifier">expected_from</span> = <span class="ruby-identifier">expected_from</span>
33:         <span class="ruby-identifier">child</span>.<span class="ruby-identifier">method_block</span> = <span class="ruby-identifier">method_block</span>
34:         <span class="ruby-identifier">child</span>.<span class="ruby-identifier">expected_received_count</span> = <span class="ruby-identifier">expected_received_count</span>
35:         <span class="ruby-identifier">new_gen</span> = <span class="ruby-identifier">error_generator</span>.<span class="ruby-identifier">clone</span>
36:         <span class="ruby-identifier">new_gen</span>.<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">opts</span>
37:         <span class="ruby-identifier">child</span>.<span class="ruby-identifier">error_generator</span> = <span class="ruby-identifier">new_gen</span>
38:         <span class="ruby-identifier">child</span>.<span class="ruby-identifier">args_to_yield</span> = <span class="ruby-ivar">@args_to_yield</span>.<span class="ruby-identifier">clone</span>
39:         <span class="ruby-identifier">child</span>
40:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000218" class="method-detail">
        <a name="M000218"></a>

        <div class="method-heading">
          <a href="#M000218" class="method-signature">
          <span class="method-name">called_max_times?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000218-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000218-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 128</span>
128:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">called_max_times?</span>
129:         <span class="ruby-ivar">@expected_received_count</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">:any</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-ivar">@expected_received_count</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span> <span class="ruby-operator">&amp;&amp;</span>
130:           <span class="ruby-ivar">@actual_received_count</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-ivar">@expected_received_count</span>
131:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000211" class="method-detail">
        <a name="M000211"></a>

        <div class="method-heading">
          <a href="#M000211" class="method-signature">
          <span class="method-name">expected_args</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000211-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000211-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 47</span>
47:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">expected_args</span>
48:         <span class="ruby-ivar">@args_expectation</span>.<span class="ruby-identifier">args</span>
49:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000217" class="method-detail">
        <a name="M000217"></a>

        <div class="method-heading">
          <a href="#M000217" class="method-signature">
          <span class="method-name">invoke</span><span class="method-args">(args, block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000217-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000217-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 95</span>
 95:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>)
 96:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@expected_received_count</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
 97:           <span class="ruby-ivar">@actual_received_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
 98:           <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">raise_expectation_error</span> <span class="ruby-ivar">@sym</span>, <span class="ruby-ivar">@expected_received_count</span>, <span class="ruby-ivar">@actual_received_count</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>
 99:         <span class="ruby-keyword kw">end</span>
100:         
101:         <span class="ruby-ivar">@order_group</span>.<span class="ruby-identifier">handle_order_constraint</span> <span class="ruby-keyword kw">self</span>
102: 
103:         <span class="ruby-keyword kw">begin</span>
104:           <span class="ruby-constant">Kernel</span><span class="ruby-operator">::</span><span class="ruby-identifier">raise</span> <span class="ruby-ivar">@exception_to_raise</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@exception_to_raise</span>.<span class="ruby-identifier">nil?</span>
105:           <span class="ruby-constant">Kernel</span><span class="ruby-operator">::</span><span class="ruby-identifier">throw</span> <span class="ruby-ivar">@symbol_to_throw</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@symbol_to_throw</span>.<span class="ruby-identifier">nil?</span>
106:           
107:           
108:           <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@method_block</span>.<span class="ruby-identifier">nil?</span>
109:             <span class="ruby-identifier">default_return_val</span> = <span class="ruby-identifier">invoke_method_block</span>(<span class="ruby-identifier">args</span>)
110:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@args_to_yield</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
111:             <span class="ruby-identifier">default_return_val</span> = <span class="ruby-identifier">invoke_with_yield</span>(<span class="ruby-identifier">block</span>)
112:           <span class="ruby-keyword kw">else</span>
113:             <span class="ruby-identifier">default_return_val</span> = <span class="ruby-keyword kw">nil</span>
114:           <span class="ruby-keyword kw">end</span>
115:           
116:           <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@consecutive</span>
117:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">invoke_consecutive_return_block</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>)
118:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@return_block</span>
119:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">invoke_return_block</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>)
120:           <span class="ruby-keyword kw">else</span>
121:             <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">default_return_val</span>
122:           <span class="ruby-keyword kw">end</span>
123:         <span class="ruby-keyword kw">ensure</span>
124:           <span class="ruby-ivar">@actual_received_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
125:         <span class="ruby-keyword kw">end</span>
126:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000216" class="method-detail">
        <a name="M000216"></a>

        <div class="method-heading">
          <a href="#M000216" class="method-signature">
          <span class="method-name">matches</span><span class="method-args">(sym, args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000216-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000216-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 91</span>
91:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">matches</span>(<span class="ruby-identifier">sym</span>, <span class="ruby-identifier">args</span>)
92:         <span class="ruby-ivar">@sym</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">sym</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@args_expectation</span>.<span class="ruby-identifier">args_match?</span>(<span class="ruby-identifier">args</span>)
93:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Protected Instance methods</h3>

      <div id="method-M000210" class="method-detail">
        <a name="M000210"></a>

        <div class="method-heading">
          <a href="#M000210" class="method-signature">
          <span class="method-name">error_generator_opts=</span><span class="method-args">(opts={})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000210-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000210-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 42</span>
42:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">error_generator_opts=</span>(<span class="ruby-identifier">opts</span>={})
43:         <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">opts</span> = <span class="ruby-identifier">opts</span>
44:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000221" class="method-detail">
        <a name="M000221"></a>

        <div class="method-heading">
          <a href="#M000221" class="method-signature">
          <span class="method-name">invoke_consecutive_return_block</span><span class="method-args">(args, block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000221-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000221-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 157</span>
157:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke_consecutive_return_block</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>)
158:         <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
159:         <span class="ruby-identifier">value</span> = <span class="ruby-ivar">@return_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
160:         
161:         <span class="ruby-identifier">index</span> = [<span class="ruby-ivar">@actual_received_count</span>, <span class="ruby-identifier">value</span>.<span class="ruby-identifier">size</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>].<span class="ruby-identifier">min</span>
162:         <span class="ruby-identifier">value</span>[<span class="ruby-identifier">index</span>]
163:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000219" class="method-detail">
        <a name="M000219"></a>

        <div class="method-heading">
          <a href="#M000219" class="method-signature">
          <span class="method-name">invoke_method_block</span><span class="method-args">(args)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000219-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000219-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 135</span>
135:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke_method_block</span>(<span class="ruby-identifier">args</span>)
136:         <span class="ruby-keyword kw">begin</span>
137:           <span class="ruby-ivar">@method_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
138:         <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">detail</span>
139:           <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">raise_block_failed_error</span> <span class="ruby-ivar">@sym</span>, <span class="ruby-identifier">detail</span>.<span class="ruby-identifier">message</span>
140:         <span class="ruby-keyword kw">end</span>
141:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000222" class="method-detail">
        <a name="M000222"></a>

        <div class="method-heading">
          <a href="#M000222" class="method-signature">
          <span class="method-name">invoke_return_block</span><span class="method-args">(args, block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000222-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000222-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 165</span>
165:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke_return_block</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">block</span>)
166:         <span class="ruby-identifier">args</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">block</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
167:         <span class="ruby-comment cmt"># Ruby 1.9 - when we set @return_block to return values</span>
168:         <span class="ruby-comment cmt"># regardless of arguments, any arguments will result in</span>
169:         <span class="ruby-comment cmt"># a &quot;wrong number of arguments&quot; error</span>
170:         <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@ignore_args</span>
171:           <span class="ruby-ivar">@return_block</span>.<span class="ruby-identifier">call</span>()
172:         <span class="ruby-keyword kw">else</span>
173:           <span class="ruby-ivar">@return_block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
174:         <span class="ruby-keyword kw">end</span>
175:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000220" class="method-detail">
        <a name="M000220"></a>

        <div class="method-heading">
          <a href="#M000220" class="method-signature">
          <span class="method-name">invoke_with_yield</span><span class="method-args">(block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000220-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000220-source">
<pre>
     <span class="ruby-comment cmt"># File vendor/plugins/rspec/lib/spec/mocks/message_expectation.rb, line 143</span>
143:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">invoke_with_yield</span>(<span class="ruby-identifier">block</span>)
144:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">nil?</span>
145:           <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">raise_missing_block_error</span> <span class="ruby-ivar">@args_to_yield</span>
146:         <span class="ruby-keyword kw">end</span>
147:         <span class="ruby-identifier">value</span> = <span class="ruby-keyword kw">nil</span>
148:         <span class="ruby-ivar">@args_to_yield</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">args_to_yield_this_time</span><span class="ruby-operator">|</span>
149:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">-1</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">args_to_yield_this_time</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span>
150:             <span class="ruby-ivar">@error_generator</span>.<span class="ruby-identifier">raise_wrong_arity_error</span> <span class="ruby-identifier">args_to_yield_this_time</span>, <span class="ruby-identifier">block</span>.<span class="ruby-identifier">arity</span>
151:           <span class="ruby-keyword kw">end</span>
152:           <span class="ruby-identifier">value</span> = <span class="ruby-identifier">block</span>.<span class="ruby-identifier">call</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args_to_yield_this_time</span>)
153:         <span class="ruby-keyword kw">end</span>
154:         <span class="ruby-identifier">value</span>
155:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>